<p>在使用正则表达式时，利用好其预编译功能，可以有效加快正则匹配速度。</p>
<p>说明：不要在方法体内定义：Pattern pattern = Pattern.compile(规则);</p>
<p>Examples:</p>
<pre>
    public class XxxClass {
        // Use precompile
        private static Pattern NUMBER_PATTERN = Pattern.compile("[0-9]+");
        public Pattern getNumberPattern() {
            // Avoid use Pattern.compile in method body.
            Pattern localPattern = Pattern.compile("[0-9]+");
            return localPattern;
        }
    }
</pre>